home *** CD-ROM | disk | FTP | other *** search
- Path: gryphon.phoenix.net!usenet
- From: brucew@phoenix.net (Bruce Wedding)
- Newsgroups: comp.lang.c
- Subject: Re: Checking for a file => Does it exist (Help)
- Date: Mon, 15 Jan 1996 01:00:31 GMT
- Organization: BranPaul Systems
- Message-ID: <4dc6kq$dja@gryphon.phoenix.net>
- References: <4d9k6fINNnja@faatcrl.faa.gov>
- NNTP-Posting-Host: dial51.phoenix.net
- X-Newsreader: Moe's Newsreader
-
- afrawert@faatcrl.faa.gov (Alan Frawert) wrote:
-
-
- >I'm having a problem just checking to see if a file
- >exists. Does anyone have a simple piece of code that I can use?
-
- Well, you could try to open it then close it:
-
- int file_exist( char *fname)
- {
- int flag = 0;
- FILE *fp = fopen( fname, "r");
- flag = fp ? 1 : 0;
- fclose(fp);
- return flag;
- }
-
- Bruce D. Wedding Have Compiler, Will Travel!
- Perspicacious Programming Performed Promptly
- Katy, Texas, USA, Planet Earth, Milkyway Galaxy, Known Universe
-
-